import React, { FC } from "react";
import { useDispatch } from "react-redux";
import { changeSelectId } from "../../../store/componentsReducer/index.ts";
import styles from "./index.module.scss";
import EditCanvas from "./EditCavas";
import LeftPanel from "./LeftPanel.tsx";
import RightPanel from "./RightPanel.tsx";
import EditHeader from "./EditHeader.tsx";
import useLoadingQuestionData from "../../../hooks/useLoadingQuestionData.ts";
import { useTitle } from "ahooks";
import useGetPageInfo from "../../../hooks/useGetPageInfo.ts";
const Edit: FC = () => {
  const { loading } = useLoadingQuestionData();
  const {title}=useGetPageInfo()
  useTitle(`问卷统计 - ${title}`)
  //取消选中
  const dispatch=useDispatch()
  const clearHandle = () => {    
    dispatch(changeSelectId(''))
  };
  return (
    <div className={styles.container}>
      <div className={styles.header}>
      <EditHeader />
      </div>
      <div className={styles["content-wrapper"]}>
        <div className={styles.content}>
          <div className={styles.left}>
          <LeftPanel />
          </div>
          <div className={styles.main} onClick={ clearHandle}>
            <div className={styles["canvas-wrapper"]}>
              <EditCanvas loading={loading} />
            </div>
          </div>
          <div className={styles.right}>
          <RightPanel />
          </div>
        </div>
      </div>
    </div>
  );
};
export default Edit;
